﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zor_Modes;
using Zor_IDAL;
using Zor_Tools;
using System.Data;
using Dapper;
namespace Zor_DAL
{
     public class Zor_PayTaxes_DAL<T> where T : class
    {
       /// <summary>
       /// 缴税管理－缴税
       /// </summary>
       /// <param name="acceptance_Id">受理单ｉｄ</param>
       /// <param name="actualtax">实际缴费额</param>
       /// <param name="pt_Id">缴税主键ｉｄ</param>
       /// <returns></returns>
         public static int AddPayTaxes(int acceptance_Id, double actualtax, int pt_Id)
        {
            var param = new DynamicParameters();
            param.Add("@Acceptance_Id", acceptance_Id);
            param.Add("@User_Id", RequestSession.GetSessionUser().User_Id);
            param.Add("@CreateTime", TimeHelper.ToTimeStamp(DateTime.Now));
            param.Add("@ActualTax", actualtax);
            param.Add("@Pt_Id ", pt_Id);          
            param.Add("@narid", 0, DbType.Int32, ParameterDirection.ReturnValue);
            using (IDbConnection conn = DapperConn.OpenSqlConnection())
            {
                var Answer = conn.Execute("Pro_PayTaxes", param, null, null, CommandType.StoredProcedure);
                return param.Get<int>("@narid");
            }
          
        }
         /// <summary>
         /// 获取所属部门名称上级部门
         /// </summary>
         /// <returns></returns>
         public static List<T> GetDtName_Up()
         {
             var sql = "select Dt_Id,Dt_Name from [dbo].[Sys_Department] where Dt_Id=(select Dt_ParentId from dbo.Sys_Department where Dt_Id =" + RequestSession.GetSessionUser().DT_Id + ") ";
             List<T> listDtName = DapperQuery<T>.DoQueryList(sql, null);
             return listDtName;
         }

    }
}
